package com.enation.app.javashop.core.client.fallback.payment;

import com.enation.app.javashop.core.client.feignimpl.payment.PaymentBillClientFeignImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.enation.app.javashop.model.payment.dos.PaymentBillDO;
import com.enation.app.javashop.model.payment.vo.PayBill;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 支付账单client factory
 * @author kingapex
 * @version 1.0
 * @data 2022/5/28 14:59
 **/
@Component
public class PaymentBillClientFeignFallbackFactory extends BaseFallbackFactory<PaymentBillClientFeignImpl> {
    @Override
    protected PaymentBillClientFeignImpl fallback() {
        return new PaymentBillClientFeignFallback();
    }

    /**
     * 支付账单client fallback
     * @author kingapex
     * @version 1.0
     * @since 7.1.0
     * 2020/4/16
     */
    @Component
    public static class PaymentBillClientFeignFallback implements PaymentBillClientFeignImpl {

        private final Logger logger = LoggerFactory.getLogger(getClass());

        @Override
        public PayBill add(PaymentBillDO paymentBill) {
            logger.error("添加支付账单异常");
            return null;
        }

        @Override
        public void deletePaymentBill(Long billId) {
            logger.error("删除支付账单异常");
        }

        @Override
        public void closeTrade(PaymentBillDO paymentBillDO) {
            logger.error("关闭支付账单异常");
        }

        @Override
        public void sendCloseTradeMessage(Map<String, Object> map) {
            logger.error("发送支付账单改变消息异常");
        }
    }
}
